package com.ph.shopping.facade.mapper;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.ph.shopping.common.core.base.BaseMapper;
import com.ph.shopping.facade.profit.entity.UnlineSupplyChainProfit;
import com.ph.shopping.facade.profit.vo.MerchantOrderVo;
import com.ph.shopping.facade.profit.vo.MerchantWithdrawalsVo;
import com.ph.shopping.facade.profit.vo.AgentWithdrawalsVo;


public interface IUnlineOrderProfitMapper extends BaseMapper<UnlineSupplyChainProfit> {

	/**
	 * 获取线下订单供应链利润分成列表
	 * @return
	 */
	public List<UnlineSupplyChainProfit> getUnlineOrderSupplyChainProfitList(@Param("orderNo") String orderNo,@Param("orderType") Integer orderType); 
	/**
	 * 导出线下订单供应链利润分成表EXCEL
	 * @return
	 */
	public List<UnlineSupplyChainProfit> exportUnlineOrderSupplyChainProfit();
	/**
	 * 查询商户交易完成并且未分润且交易完成时间大于7天的数据(商户进货订单表)(注：保持交易完成这个状态7天)
	 * @return
	 */
	public List<MerchantOrderVo> getUnLineOrderSupplyChainProfit();
	/**
	 * 接下来执行分润 将数据插入 ph_unline_supplychain_profit 表
	 */
	public void  insertUnlineSupplyChainProfitList(List<UnlineSupplyChainProfit> unlineSupplyChainProfitList);
	/**
	 * 接下来更改 ph_merchant_order 字段bonus为2(已分润)
	 */
	public void  updateMerchantOrderBonus(List<MerchantOrderVo> merchantOrderVoList);
	/**
	 * 查询到所有的商户提现记录
	 */
	public List<MerchantWithdrawalsVo> getMerchantWithdrawalsVoList(@Param("maxTime") String maxTime);
	
	/**
	 * 查询到所有的代理提现记录
	 */
	public List<AgentWithdrawalsVo> getAgentWithdrawalsVoList(@Param("maxTime") String maxTime);
	
	/**
	 * 查询ph_merchant_withdrawals_into_profit 是否有记录(商户和代理商提现都入库)
	 * @return
	 */
	public  Integer   selectMerchantWithdrawalsIntoProfitCount(@Param("type") Integer type);
	
	/**
	 * 查询ph_merchant_withdrawals_into_profit 最大时间(商户和代理商提现都入库)
	 * @return
	 */
	public Date selectMaxTime(@Param("type") Integer type);
	/**
	 * 将商户的提现记录插入到分润表中
	 */
	public void  insertUnlineSupplyChainProfitListForMerchantWithdrawals(List<MerchantWithdrawalsVo>  merchantWithdrawalsVoList);
	/**
	 * 将代理的提现记录插入到分润表中
	 */
	public void  insertUnlineSupplyChainProfitListForAgentWithdrawals(List<AgentWithdrawalsVo>  agentWithdrawalsVoList);
	/**
	 * 插入时间到时间临时表
	 */
	public void insertWithdrawalsIntoProfit(@Param("maxCreateDate") Date maxCreateDate,@Param("type") Integer type);
	
	/**
	 * 修改审核状态
	 * @param unlineSupplyChainProfit
	 */
	public void updateProfitByPrimaryKey(UnlineSupplyChainProfit unlineSupplyChainProfit);
}
